Skip to content

idle snapshot 测试改轮询等待,消除 CI 时序假失败 - #313

Merged
taekchef merged 1 commit into
mainfrom
codex/idle-snapshot-test-stabilize
Aug 22, 2026
Merged

taekchef merged 1 commit into
mainfrom
codex/idle-snapshot-test-stabilize

Conversation

@taekchef

Copy link
Copy Markdown
Collaborator

实际改动

  • Tests/WeiBeiSafetyTests/NoteEditingSessionTests.swift testDirtyInputSchedulesOneIdleSnapshot:固定 Task.sleep(100ms) 改为最长 2s、每 10ms 的轮询等待,等待条件是快照命令已到达。
  • 断言语义完全不变(恰好一条命令、minimumRevision == 2);正常路径仍在约一个空闲延迟(20ms)内完成,只有真实失败才会等满 2s。

背景

该测试 2026-08-22 当天三次首跑假失败(#287、#306、#311),均为满载 runner 上 20ms 空闲计时器超出主线程调度窗口,断言时命令尚未到达(0≠1、nil≠Optional(2))。重跑均绿。

未做内容

  • 不注入时钟/调度器(改动面大);轮询已足够确定性。
  • 不触碰任何产品代码。

验证

  • swiftc -parse 语法通过;本地无 XCTest 运行时(无 Xcode),类型与运行结果由本 PR 的 CI 全量验证。

共享核心文件占用

  • 无(仅测试文件)。

冒烟说明

  • 纯测试改动,无用户可见变化,不适用 App 冒烟。

固定 100ms 睡眠在满载 CI runner 上会被 20ms 空闲计时器超出
主线程调度窗口,今天三次假失败(#287/#306/#311)。改为最长 2s
的 10ms 轮询:正常路径仍在一个空闲延迟内返回,只有真实失败才
等满时限;断言语义(恰好一条、最小修订 2)不变。
@taekchef
taekchef marked this pull request as ready for review August 22, 2026 05:56
@taekchef
taekchef merged commit 7cc6c27 into main Aug 22, 2026
2 checks passed
@taekchef
taekchef deleted the codex/idle-snapshot-test-stabilize branch August 22, 2026 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant